package com.jdbcTemplateDemo;

import com.dao.impl.AccountDao;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DriverManagerDataSource;

public class JdbcTemplateDemo {
    public static void main(String[] args) {
        var jdbcTemplate = new JdbcTemplate();
        var datasource = new DriverManagerDataSource();
        datasource.setUrl("jdbc:mysql://localhost:3306/mydb2?serverTimezone=UTC");
        datasource.setDriverClassName("com.mysql.cj.jdbc.Driver");
        datasource.setPassword("root");
        datasource.setUsername("root");
        jdbcTemplate.setDataSource(datasource);
        var accountDao = new AccountDao();
        accountDao.setJdbcTemplate(jdbcTemplate);
        var account = accountDao.findByName("aaa");
        System.out.println(account.toString());
    }
}
